package cc.vv.btpartyjob.partyservice.adapter

import android.annotation.SuppressLint
import android.os.Build
import android.support.annotation.RequiresApi
import android.widget.TextView
import cc.vv.baselibrary.adapter.SimpleCommonAdapter
import cc.vv.baselibrary.adapter.holder.ExtendViewHolder
import cc.vv.btpartyjob.partyservice.R
import cc.vv.btpartyjob.partyservice.module.bean.MicDonationBean
import cc.vv.btpartyjob.partyservice.module.bean.TinyWishBean

/**
 * 微捐赠adapter
 * Created by Chen.qi on 2018/10/24.
 */
class MicroDonationAdapter(layoutResId: Int) : SimpleCommonAdapter<MicDonationBean>(layoutResId) {
    @RequiresApi(Build.VERSION_CODES.LOLLIPOP)
    @SuppressLint("SetTextI18n")
    override fun convert(helper: ExtendViewHolder, item: MicDonationBean, position: Int) {
        //内容
        helper.getView<TextView>(R.id.tv_itw_content)?.text = item.microDonationConetnt

        //发布人
        helper.getView<TextView>(R.id.tv_itw_yyPer)?.text = "捐赠人：${item.microDonationName}"

        //未认领
        val tvStatus = helper.getView<TextView>(R.id.tv_itw_status)
        if (item.claimState == 0) {
            //未认领
            tvStatus?.text = "未认领"
            tvStatus?.background = mContext.getDrawable(R.drawable.shape_ren_ling_status_yes)
        } else if (item.claimState == 1) {
            //已认领
            tvStatus?.text = "已认领"
            tvStatus?.background = mContext.getDrawable(R.drawable.shape_ren_ling_status_no)
        }


    }
}